package com.xbongbong.saas.enums;

import com.xbongbong.paas.enums.FieldTypeEnum;
import com.xbongbong.paas.enums.PlatFormEnum;
import com.xbongbong.saas.enums.business.*;
import com.xbongbong.saas.enums.product.PriceSetEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

/**
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/5/18 14:39
 * @since v1.0
 */

@Getter
public enum DefaultScreenEnum {
    /**
     * 默认筛选项
     */
    CUSTOMER(XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode(),Arrays.asList(CustomerManagementEnum.TYPE.getAttr(), CustomerManagementEnum.IS_INDIVIDUAL.getAttr(),CustomerManagementEnum.SCALE.getAttr(),CustomerManagementEnum.INDUSTRY.getAttr(),CustomerManagementEnum.IMPORTANT_DEGREE.getAttr(),CustomerManagementEnum.LAST_CONNECT_TIME.getAttr(),CustomerManagementEnum.ADD_TIME.getAttr(),CustomerManagementEnum.UPDATE_TIME.getAttr()),Arrays.asList(CustomerManagementEnum.TYPE.getAttr(), CustomerManagementEnum.IS_INDIVIDUAL.getAttr(),CustomerManagementEnum.SCALE.getAttr(),CustomerManagementEnum.INDUSTRY.getAttr(),CustomerManagementEnum.IMPORTANT_DEGREE.getAttr(),CustomerManagementEnum.LAST_CONNECT_TIME.getAttr(),CustomerManagementEnum.ADD_TIME.getAttr(),CustomerManagementEnum.UPDATE_TIME.getAttr())),
    CONTRACT(XbbRefTypeEnum.CONTRACT.getCode(),Arrays.asList(ContractEnum.LINK_CUSTOMER.getAttr(),ContractEnum.PRODUCT.getAttr(),ContractEnum.AMOUNT.getAttr(),ContractEnum.SIGN_TIME.getAttr(),ContractEnum.STATUS.getAttr(),ContractEnum.TYPE.getAttr(),ContractEnum.DEADLINE.getAttr(),ContractEnum.ADD_TIME.getAttr()),Arrays.asList(ContractEnum.LINK_CUSTOMER.getAttr(),ContractEnum.PRODUCT.getAttr(),ContractEnum.AMOUNT.getAttr(),ContractEnum.SIGN_TIME.getAttr(),ContractEnum.STATUS.getAttr(),ContractEnum.TYPE.getAttr(),ContractEnum.DEADLINE.getAttr(),ContractEnum.ADD_TIME.getAttr())),
    OPPORTUNITY(XbbRefTypeEnum.SALES_OPPORTUNITY.getCode(),Arrays.asList(SalesOpportunityEnum.CUSTOMER_NAME.getAttr(),SalesOpportunityEnum.SALE_STAGE.getAttr(),SalesOpportunityEnum.ESTIMATE_END_TIME.getAttr(),SalesOpportunityEnum.IMPORTANT_DEGREE.getAttr(),SalesOpportunityEnum.LAST_CONNECT_TIME.getAttr(),SalesOpportunityEnum.ESTIMATE_AMOUNT.getAttr(),SalesOpportunityEnum.ADD_TIME.getAttr()),Arrays.asList(SalesOpportunityEnum.CUSTOMER_NAME.getAttr(),SalesOpportunityEnum.SALE_STAGE.getAttr(),SalesOpportunityEnum.ESTIMATE_END_TIME.getAttr(),SalesOpportunityEnum.IMPORTANT_DEGREE.getAttr(),SalesOpportunityEnum.LAST_CONNECT_TIME.getAttr(),SalesOpportunityEnum.ESTIMATE_AMOUNT.getAttr(),SalesOpportunityEnum.ADD_TIME.getAttr())),
    CONTACT(XbbRefTypeEnum.CONTACT.getCode(),Arrays.asList(ContactEnum.CUSTOMER_NAME.getAttr(),ContactEnum.LEVEL.getAttr(),ContactEnum.CREATOR_ID.getAttr(),ContactEnum.ADD_TIME.getAttr(),ContactEnum.UPDATE_TIME.getAttr()),Arrays.asList(ContactEnum.CUSTOMER_NAME.getAttr(),ContactEnum.LEVEL.getAttr(),ContactEnum.CREATOR_ID.getAttr(),ContactEnum.ADD_TIME.getAttr(),ContactEnum.UPDATE_TIME.getAttr())),
    REFUND(XbbRefTypeEnum.REFUND.getCode(),Arrays.asList(RefundEnum.CUSTOMER_ID.getAttr(),RefundEnum.RETURN_AMOUNT.getAttr(),RefundEnum.SIGN_DATE.getAttr(),RefundEnum.REFUND_REASON.getAttr()),Arrays.asList(RefundEnum.CUSTOMER_ID.getAttr(),RefundEnum.RETURN_AMOUNT.getAttr(),RefundEnum.SIGN_DATE.getAttr(),RefundEnum.REFUND_REASON.getAttr())),
    PAYMENT(XbbRefTypeEnum.PAYMENT.getCode(),Arrays.asList(PaymentEnum.AMOUNT.getAttr(),PaymentEnum.ESTIMATE_TIME.getAttr(),PaymentEnum.STATUS.getAttr(),PaymentEnum.PAYMENT_TYPE.getAttr()),Arrays.asList(PaymentEnum.AMOUNT.getAttr(),PaymentEnum.ESTIMATE_TIME.getAttr(),PaymentEnum.STATUS.getAttr(),PaymentEnum.PAYMENT_TYPE.getAttr())),
    PAYPLAN(XbbRefTypeEnum.PAY_PLAN.getCode(),Arrays.asList(PayPlanEnum.AMOUNT.getAttr(),PayPlanEnum.ESTIMATE_TIME.getAttr(),PayPlanEnum.STATUS.getAttr(),PayPlanEnum.PAY_TYPE.getAttr()),Arrays.asList(PayPlanEnum.AMOUNT.getAttr(),PayPlanEnum.ESTIMATE_TIME.getAttr(),PayPlanEnum.STATUS.getAttr(),PayPlanEnum.PAY_TYPE.getAttr())),
    INVOICE(XbbRefTypeEnum.INVOICE.getCode(),Arrays.asList(InvoiceEnum.CONTRACT_ID.getAttr(),InvoiceEnum.CUSTOMER_NAME.getAttr(),InvoiceEnum.APPLY_USER.getAttr(),InvoiceEnum.INVOICE_DATE.getAttr()),Arrays.asList(InvoiceEnum.CONTRACT_ID.getAttr(),InvoiceEnum.CUSTOMER_NAME.getAttr(),InvoiceEnum.APPLY_USER.getAttr(),InvoiceEnum.INVOICE_DATE.getAttr())),
    PURCHASE_INVOICE(XbbRefTypeEnum.PURCHASE_INVOICE.getCode(),Arrays.asList(PurchaseInvoiceEnum.PURCHASE_ID.getAttr(),PurchaseInvoiceEnum.SUPPLIER_NAME.getAttr(),PurchaseInvoiceEnum.APPLY_USER.getAttr(),PurchaseInvoiceEnum.INVOICE_DATE.getAttr()),Arrays.asList(PurchaseInvoiceEnum.PURCHASE_ID.getAttr(),PurchaseInvoiceEnum.SUPPLIER_NAME.getAttr(),PurchaseInvoiceEnum.APPLY_USER.getAttr(),PurchaseInvoiceEnum.INVOICE_DATE.getAttr())),
    SUPPLIER(XbbRefTypeEnum.SUPPLIER.getCode(),Arrays.asList(SupplierEnum.QUALITY_STANDARD.getAttr(),SupplierEnum.SUPPLY_COST.getAttr(),SupplierEnum.DELIVERY_CAPACITY.getAttr(),SupplierEnum.SERVER_CAPACITY.getAttr(),SupplierEnum.CREDIT_LEVEL.getAttr()),Arrays.asList(SupplierEnum.QUALITY_STANDARD.getAttr(),SupplierEnum.SUPPLY_COST.getAttr(),SupplierEnum.DELIVERY_CAPACITY.getAttr(),SupplierEnum.SERVER_CAPACITY.getAttr(),SupplierEnum.CREDIT_LEVEL.getAttr())),
    SUPPLIER_CONTACT(XbbRefTypeEnum.SUPPLIER_CONTACT.getCode(),Arrays.asList(SupplierContactEnum.SUPPLIER_ID.getAttr(),SupplierContactEnum.LEVEL.getAttr(),SupplierContactEnum.CREATOR_ID.getAttr(),SupplierContactEnum.ADD_TIME.getAttr(),SupplierContactEnum.UPDATE_TIME.getAttr()),Arrays.asList(SupplierContactEnum.SUPPLIER_ID.getAttr(),SupplierContactEnum.LEVEL.getAttr(),SupplierContactEnum.CREATOR_ID.getAttr(),SupplierContactEnum.ADD_TIME.getAttr(),SupplierContactEnum.UPDATE_TIME.getAttr())),
    PURCHASE(XbbRefTypeEnum.PURCHASE.getCode(),Arrays.asList(PurchaseEnum.CREATOR_ID.getAttr(), PurchaseEnum.UPDATE_TIME.getAttr()),Arrays.asList(PurchaseEnum.CREATOR_ID.getAttr(), PurchaseEnum.UPDATE_TIME.getAttr())),
    RETURNED_PURCHASE(XbbRefTypeEnum.RETURNED_PURCHASE.getCode(),Arrays.asList(ReturnedPurchaseEnum.STATUS.getAttr(), ReturnedPurchaseEnum.PRODUCTS.getAttr()),Arrays.asList(ReturnedPurchaseEnum.STATUS.getAttr(), ReturnedPurchaseEnum.PRODUCTS.getAttr())),
    BOM(XbbRefTypeEnum.BOM_BILL.getCode(),Arrays.asList(BomBillEnum.STATUS.getAttr()),Arrays.asList(BomBillEnum.STATUS.getAttr())),
    PRODUCTION_ORDER(XbbRefTypeEnum.PRODUCTION_ORDER.getCode(),Arrays.asList(ProductionOrderEnum.STATUS.getAttr()),Arrays.asList(ProductionOrderEnum.STATUS.getAttr())),
    ASSEMBLE(XbbRefTypeEnum.ASSEMBLE.getCode(),Arrays.asList(AssembleEnum.OUT_PRODUCTS.getAttr(), AssembleEnum.IN_PRODUCTS.getAttr()),Arrays.asList(AssembleEnum.OUT_PRODUCTS.getAttr(), AssembleEnum.IN_PRODUCTS.getAttr())),
    INSTOCK(XbbRefTypeEnum.INSTOCK.getCode(),Arrays.asList(InstockEnum.WAREHOUSE_ID.getAttr(),InstockEnum.TYPE.getAttr(), InstockEnum.PRODUCT.getAttr()),Arrays.asList(InstockEnum.WAREHOUSE_ID.getAttr(),InstockEnum.TYPE.getAttr(), InstockEnum.PRODUCT.getAttr())),
    PURCHASE_INSTOCK(XbbRefTypeEnum.PURCHASE_INSTOCK.getCode(), Arrays.asList(PurchaseInstockEnum.SHEET_NO.getAttr(), PurchaseInstockEnum.SUPPLIER_ID.getAttr(), PurchaseInstockEnum.TIME.getAttr(), PurchaseInstockEnum.WAREHOUSE_ID.getAttr(), PurchaseInstockEnum.ADD_TIME.getAttr()), Arrays.asList(PurchaseInstockEnum.SHEET_NO.getAttr(), PurchaseInstockEnum.SUPPLIER_ID.getAttr(), PurchaseInstockEnum.TIME.getAttr(), PurchaseInstockEnum.WAREHOUSE_ID.getAttr(), PurchaseInstockEnum.ADD_TIME.getAttr())),
    REFUND_INSTOCK(XbbRefTypeEnum.REFUND_INSTOCK.getCode(), Arrays.asList(RefundInstockEnum.SHEET_NO.getAttr(), RefundInstockEnum.TIME.getAttr(), RefundInstockEnum.CUSTOMER_ID.getAttr(), RefundInstockEnum.ADD_TIME.getAttr()), Arrays.asList(RefundInstockEnum.SHEET_NO.getAttr(), RefundInstockEnum.TIME.getAttr(), RefundInstockEnum.CUSTOMER_ID.getAttr(), RefundInstockEnum.ADD_TIME.getAttr())),
    PRODUCTION_INSTOCK(XbbRefTypeEnum.PRODUCTION_INSTOCK.getCode(), Arrays.asList(ProductionInstockEnum.SHEET_NO.getAttr(), ProductionInstockEnum.TIME.getAttr(), ProductionInstockEnum.REF_ID.getAttr(), ProductionInstockEnum.ADD_TIME.getAttr()), Arrays.asList(ProductionInstockEnum.SHEET_NO.getAttr(), ProductionInstockEnum.TIME.getAttr(), ProductionInstockEnum.REF_ID.getAttr(), ProductionInstockEnum.ADD_TIME.getAttr())),
    RETURNED_MATERIEL_INSTOCK(XbbRefTypeEnum.RETURNED_MATERIEL_INSTOCK.getCode(), Arrays.asList(ReturnedMaterielInstockEnum.SHEET_NO.getAttr(), ReturnedMaterielInstockEnum.MANAGER_ID.getAttr(), ReturnedMaterielInstockEnum.TIME.getAttr(), ReturnedMaterielInstockEnum.ADD_TIME.getAttr()), Arrays.asList(ReturnedMaterielInstockEnum.SHEET_NO.getAttr(), ReturnedMaterielInstockEnum.MANAGER_ID.getAttr(), ReturnedMaterielInstockEnum.TIME.getAttr(), ReturnedMaterielInstockEnum.ADD_TIME.getAttr())),
    OTHER_INSTOCK(XbbRefTypeEnum.OTHER_INSTOCK.getCode(), Arrays.asList(InstockEnum.WAREHOUSE_ID.getAttr(), InstockEnum.TYPE.getAttr(), InstockEnum.PRODUCT.getAttr()), Arrays.asList(InstockEnum.WAREHOUSE_ID.getAttr(), InstockEnum.TYPE.getAttr(), InstockEnum.PRODUCT.getAttr())),
    OUTSTOCK(XbbRefTypeEnum.OUTSTOCK.getCode(),Arrays.asList(OutstockEnum.WAREHOUSE_ID.getAttr(),OutstockEnum.TYPE.getAttr(),OutstockEnum.PRODUCT.getAttr()),Arrays.asList(OutstockEnum.WAREHOUSE_ID.getAttr(),OutstockEnum.TYPE.getAttr(),OutstockEnum.PRODUCT.getAttr())),
    CONTRACT_OUTSTOCK(XbbRefTypeEnum.CONTRACT_OUTSTOCK.getCode(), Arrays.asList(ContractOutstockEnum.SHEET_NO.getAttr(), ContractOutstockEnum.TIME.getAttr(), ContractOutstockEnum.MANAGER_ID.getAttr(), ContractOutstockEnum.REF_ID.getAttr(), ContractOutstockEnum.ADD_TIME.getAttr()), Arrays.asList(ContractOutstockEnum.SHEET_NO.getAttr(), ContractOutstockEnum.TIME.getAttr(), ContractOutstockEnum.MANAGER_ID.getAttr(), ContractOutstockEnum.REF_ID.getAttr(), ContractOutstockEnum.ADD_TIME.getAttr())),
    RETURNED_PURCHASE_OUTSTOCK(XbbRefTypeEnum.RETURNED_PURCHASE_OUTSTOCK.getCode(), Arrays.asList(ReturnedPurchaseOutstockEnum.SHEET_NO.getAttr(), ReturnedPurchaseOutstockEnum.TIME.getAttr(), ReturnedPurchaseOutstockEnum.LINK_SUPPLIER.getAttr(), ReturnedPurchaseOutstockEnum.WAREHOUSE_ID.getAttr(), ReturnedPurchaseOutstockEnum.ADD_TIME.getAttr()), Arrays.asList(ReturnedPurchaseOutstockEnum.SHEET_NO.getAttr(), ReturnedPurchaseOutstockEnum.TIME.getAttr(), ReturnedPurchaseOutstockEnum.LINK_SUPPLIER.getAttr(), ReturnedPurchaseOutstockEnum.WAREHOUSE_ID.getAttr(), ReturnedPurchaseOutstockEnum.ADD_TIME.getAttr())),
    PRODUCTION_MATERIEL_OUTSTOCK(XbbRefTypeEnum.PRODUCTION_MATERIEL_OUTSTOCK.getCode(), Arrays.asList(ProductionMaterielOutstockEnum.REF_ID.getAttr(), ProductionMaterielOutstockEnum.TIME.getAttr(), ProductionMaterielOutstockEnum.PRODUCT.getAttr(), ProductionMaterielOutstockEnum.WAREHOUSE_ID.getAttr()), Arrays.asList(ProductionMaterielOutstockEnum.REF_ID.getAttr(), ProductionMaterielOutstockEnum.TIME.getAttr(), ProductionMaterielOutstockEnum.PRODUCT.getAttr(), ProductionMaterielOutstockEnum.WAREHOUSE_ID.getAttr())),
    WORK_ORDER_OUTSTOCK(XbbRefTypeEnum.WORK_ORDER_OUTSTOCK.getCode(), Arrays.asList(WorkOrderOutstockEnum.LINK_CUSTOMER.getAttr(), WorkOrderOutstockEnum.TIME.getAttr(), WorkOrderOutstockEnum.WAREHOUSE_ID.getAttr(), WorkOrderOutstockEnum.PRODUCT.getAttr()), Arrays.asList(WorkOrderOutstockEnum.LINK_CUSTOMER.getAttr(), WorkOrderOutstockEnum.TIME.getAttr(), WorkOrderOutstockEnum.WAREHOUSE_ID.getAttr(), WorkOrderOutstockEnum.PRODUCT.getAttr())),
    OTHER_OUTSTOCK(XbbRefTypeEnum.OTHER_OUTSTOCK.getCode(), Arrays.asList(OutstockEnum.WAREHOUSE_ID.getAttr(), OutstockEnum.REF_ID.getAttr(), OutstockEnum.TIME.getAttr(), OutstockEnum.PRODUCT.getAttr()), Arrays.asList(OutstockEnum.WAREHOUSE_ID.getAttr(), OutstockEnum.REF_ID.getAttr(), OutstockEnum.TIME.getAttr(), OutstockEnum.PRODUCT.getAttr())),
    INVENTORY(XbbRefTypeEnum.INVENTORY.getCode(),Arrays.asList(InventoryEnum.WAREHOUSE_ID.getAttr(),InventoryEnum.PRODUCT.getAttr(), InventoryEnum.TIME.getAttr()),Arrays.asList(InventoryEnum.WAREHOUSE_ID.getAttr(),InventoryEnum.PRODUCT.getAttr(), InventoryEnum.TIME.getAttr())),
    TRANSFER(XbbRefTypeEnum.TRANSFER.getCode(),Arrays.asList(TransferEnum.PRODUCTS.getAttr(),TransferEnum.OUT_WAREHOUSE_ID.getAttr(),TransferEnum.INTO_WAREHOUSE_ID.getAttr(), TransferEnum.TRANSFER_TIME.getAttr()),Arrays.asList(TransferEnum.PRODUCTS.getAttr(),TransferEnum.OUT_WAREHOUSE_ID.getAttr(),TransferEnum.INTO_WAREHOUSE_ID.getAttr(), TransferEnum.TRANSFER_TIME.getAttr())),
//    WAREHOURSE(XbbRefTypeEnum.)
    STOCK(XbbRefTypeEnum.STOCK_SEARCH.getCode(),Arrays.asList(ProductEnum.CATEGORY_ID.getAttr()),Arrays.asList(ProductEnum.CATEGORY_ID.getAttr())),
    // 批次保质期筛选
    GUARANTEE_SEARCH(XbbRefTypeEnum.GUARANTEE_SEARCH.getCode(), Arrays.asList(ProductEnum.WAREHOUSE.getAttr(), ProductEnum.NAME.getAttr(), SelectProductEnum.BATCH.getSaasAttr()),Arrays.asList(ProductEnum.WAREHOUSE.getAttr(), ProductEnum.NAME.getAttr(), SelectProductEnum.BATCH.getSaasAttr())),
    WARNING_SEARCH(XbbRefTypeEnum.WARNING_SEARCH.getCode(), Arrays.asList(ProductEnum.WAREHOUSE.getAttr(), ProductEnum.NAME.getAttr(), ProductEnum.SERIALNO.getAttr(), ProductEnum.SPECIFICATION.getAttr()),Arrays.asList(ProductEnum.WAREHOUSE.getAttr(), ProductEnum.NAME.getAttr(), ProductEnum.SERIALNO.getAttr(), ProductEnum.SPECIFICATION.getAttr())),
    WOKR_ORDER(XbbRefTypeEnum.WORK_ORDER.getCode(),Arrays.asList(WorkOrderEnum.LINK_CUSTOMER.getAttr(), WorkOrderEnum.LINK_OPPORTUNITY.getAttr(),WorkOrderEnum.LINK_CONTRACT.getAttr(),WorkOrderEnum.EMERGENCY_LEVEL.getAttr(),WorkOrderEnum.STATUS.getAttr(),WorkOrderEnum.TIME_OUT.getAttr()),Arrays.asList(WorkOrderEnum.LINK_CUSTOMER.getAttr(), WorkOrderEnum.LINK_OPPORTUNITY.getAttr(),WorkOrderEnum.LINK_CONTRACT.getAttr(),WorkOrderEnum.EMERGENCY_LEVEL.getAttr(),WorkOrderEnum.STATUS.getAttr(),WorkOrderEnum.TIME_OUT.getAttr())),
    WAIT_PURCHASE_CONTRACT(XbbRefTypeEnum.WAIT_PURCHASE_CONTRACT.getCode(),Arrays.asList(ContractEnum.CONTRACT_NO.getAttr()),Arrays.asList(ContractEnum.CONTRACT_NO.getAttr())),
    WAIT_PURCHASE_PRODUCT(XbbRefTypeEnum.WAIT_PURCHASE_PRODUCT.getCode(),Arrays.asList(ProductEnum.NAME.getAttr()),Arrays.asList(ProductEnum.NAME.getAttr())),
    WAIT_PRODUCE_CONTRACT(XbbRefTypeEnum.WAIT_PRODUCE_CONTRACT.getCode(),Arrays.asList(ContractEnum.CONTRACT_NO.getAttr()),Arrays.asList(ContractEnum.CONTRACT_NO.getAttr())),
    WAIT_PRODUCE_PRODUCT(XbbRefTypeEnum.WAIT_PRODUCE_PRODUCT.getCode(),Arrays.asList(ProductEnum.NAME.getAttr()),Arrays.asList(ProductEnum.NAME.getAttr())),
    WAIT_OUTSTOCK(XbbRefTypeEnum.WAIT_OUTSTOCK.getCode(),Arrays.asList(ContractEnum.CONTRACT_NO.getAttr()),Arrays.asList(ContractEnum.CONTRACT_NO.getAttr())),
    WAIT_INSTOCK_PURCHASE(XbbRefTypeEnum.WAIT_INSTOCK_PURCHASE.getCode(),Arrays.asList(PurchaseEnum.SHEET_NO.getAttr()),Arrays.asList(PurchaseEnum.SHEET_NO.getAttr())),
    PAYMENT_SHEET(XbbRefTypeEnum.PAYMENT_SHEET.getCode(),Arrays.asList(PaymentSheetEnum.CUSTOMER_ID.getAttr(),PaymentSheetEnum.CONTRACT.getAttr(),PaymentSheetEnum.PAYMENT_TIME.getAttr(),PaymentSheetEnum.BELONG_ID.getAttr()),Arrays.asList(PaymentSheetEnum.CUSTOMER_ID.getAttr(),PaymentSheetEnum.CONTRACT.getAttr(),PaymentSheetEnum.BELONG_ID.getAttr())),
    PRODUCT(XbbRefTypeEnum.PRODUCT.getCode(),Arrays.asList(ProductEnum.CATEGORY_ID.getAttr()),Arrays.asList(ProductEnum.CATEGORY_ID.getAttr())),
    SUPPLIER_PRODUCT(XbbRefTypeEnum.SUPPLIER_PRODUCT.getCode(), Collections.singletonList(SupplierEnum.PRODUCT_LIST.getAttr()), Arrays.asList()),
    PAY_SHEET(XbbRefTypeEnum.PAY_SHEET.getCode(),Arrays.asList(PaySheetEnum.LINK_SUPPLIER.getAttr(),PaySheetEnum.LINK_PURCHASE.getAttr(),PaySheetEnum.REAL_PAY_TIME.getAttr(),PaySheetEnum.BELONG_ID.getAttr()),Arrays.asList(PaySheetEnum.LINK_SUPPLIER.getAttr(),PaySheetEnum.LINK_PURCHASE.getAttr(),PaySheetEnum.BELONG_ID.getAttr())),
    PREPAY_BALANCE(XbbRefTypeEnum.PREPAY_BALANCE.getCode(),Arrays.asList(PayBalanceEnum.ADVANCE_PAY_BALANCE.getAttr(),PayBalanceEnum.SUPPLIER_ID.getAttr(),PayBalanceEnum.UPDATE_TIME.getAttr()),Arrays.asList(PayBalanceEnum.ADVANCE_PAY_BALANCE.getAttr(),PayBalanceEnum.SUPPLIER_ID.getAttr(),PayBalanceEnum.UPDATE_TIME.getAttr())),
    STOCK_FLOW_BILL(XbbRefTypeEnum.STOCK_FLOW_BILL.getCode(),Arrays.asList(StockFlowBillEnum.WAREHOUSE_ID.getAttr(), SelectProductEnum.PRODUCT.getAttr(), StockFlowBillEnum.TYPE.getAttr()), Arrays.asList(StockFlowBillEnum.WAREHOUSE_ID.getAttr(), SelectProductEnum.PRODUCT.getAttr(), StockFlowBillEnum.TYPE.getAttr())),
    BATCH_FLOW_BILL(XbbRefTypeEnum.BATCH_FLOW_BILL.getCode(),Arrays.asList(BatchFlowBillEnum.WAREHOUSE_ID.getAttr(), SelectProductEnum.PRODUCT.getAttr(), BatchFlowBillEnum.TYPE.getAttr(), BatchFlowBillEnum.BATCH.getAttr()), Arrays.asList(BatchFlowBillEnum.WAREHOUSE_ID.getAttr(), SelectProductEnum.PRODUCT.getAttr(), BatchFlowBillEnum.TYPE.getAttr(), BatchFlowBillEnum.BATCH.getAttr())),
    STOCK_STANDING_BOOK(XbbRefTypeEnum.STOCK_STANDING_BOOK.getCode(),Arrays.asList(StockFlowBillEnum.WAREHOUSE_ID.getAttr(), SelectProductEnum.PRODUCT.getAttr()),Arrays.asList(StockFlowBillEnum.WAREHOUSE_ID.getAttr(), SelectProductEnum.PRODUCT.getAttr())),
    SEQ_SEARCH(XbbRefTypeEnum.SEQ_SEARCH.getCode(), Arrays.asList(ProductSerialBalanceEnum.SEQ.getAttr(), ProductSerialBalanceEnum.WAREHOUSE_ID.getAttr(), ProductSerialBalanceEnum.NAME.getAttr()), Arrays.asList(ProductSerialBalanceEnum.SEQ.getAttr(), ProductSerialBalanceEnum.WAREHOUSE_ID.getAttr(), ProductSerialBalanceEnum.NAME.getAttr())),
    CUSTOMER_COMMUNICATE(XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode(), Arrays.asList(CustomerCommunicateEnum.CUSTOMER_NAME.getAttr(),CustomerCommunicateEnum.TYPE.getAttr(),CustomerCommunicateEnum.COMMUNICATE_TIME.getAttr(),CustomerCommunicateEnum.MEMO.getAttr()),Arrays.asList(CustomerCommunicateEnum.CUSTOMER_NAME.getAttr(),CustomerCommunicateEnum.TYPE.getAttr(),CustomerCommunicateEnum.COMMUNICATE_TIME.getAttr(),CustomerCommunicateEnum.MEMO.getAttr())),
    SUPPLIER_COMMUNICATE(XbbRefTypeEnum.SUPPLIER_COMMUNICATE.getCode(),Arrays.asList(SupplierCommunicateEnum.SUPPLIER_ID.getAttr(),SupplierCommunicateEnum.TYPE.getAttr(),SupplierCommunicateEnum.COMMUNICATE_TIME.getAttr(),SupplierCommunicateEnum.MEMO.getAttr()),Arrays.asList(SupplierCommunicateEnum.SUPPLIER_ID.getAttr(),SupplierCommunicateEnum.TYPE.getAttr(),SupplierCommunicateEnum.COMMUNICATE_TIME.getAttr(),SupplierCommunicateEnum.MEMO.getAttr())),
    WORK_REPORT(XbbRefTypeEnum.WORK_REPORT.getCode(),Arrays.asList(WorkReportFieldEnum.TYPE.getAttr(),WorkReportFieldEnum.REPORT_DATE.getAttr()),Arrays.asList(WorkReportFieldEnum.TYPE.getAttr(),WorkReportFieldEnum.REPORT_DATE.getAttr())),
    CLUE(XbbRefTypeEnum.CLUE.getCode(),Arrays.asList(ClueEnum.COMPANY_NAME.getAttr(),ClueEnum.MARKET_ACTIVITY_ID.getAttr(),ClueEnum.LABEL.getAttr()),Arrays.asList(ClueEnum.COMPANY_NAME.getAttr(),ClueEnum.MARKET_ACTIVITY_ID.getAttr(),ClueEnum.LABEL.getAttr())),
    MARKET_ACTIVITY(XbbRefTypeEnum.MARKET_ACTIVITY.getCode(),Arrays.asList(MarketActivityEnum.NAME.getAttr(),MarketActivityEnum.START_TIME.getAttr(),MarketActivityEnum.LABEL.getAttr()),Arrays.asList(MarketActivityEnum.NAME.getAttr(),MarketActivityEnum.START_TIME.getAttr(),MarketActivityEnum.LABEL.getAttr())),
    MARKETING_ACTIVITY_MANAGEMENT(XbbRefTypeEnum.MARKETING_ACTIVITY_MANAGEMENT.getCode(), Arrays.asList(MarketingActivityManagementEnum.CREATOR_ID.getAttr(), MarketingActivityManagementEnum.STATUS.getAttr()), Arrays.asList(MarketingActivityManagementEnum.CREATOR_ID.getAttr(), MarketingActivityManagementEnum.STATUS.getAttr())),
    PROMOTION_ACTIVITY_MANAGEMENT(XbbRefTypeEnum.PROMOTION_ACTIVITY_MANAGEMENT.getCode(), Arrays.asList(PromotionActivityManagementEnum.CREATOR_ID.getAttr(), MarketingActivityManagementEnum.STATUS.getAttr()), Arrays.asList(PromotionActivityManagementEnum.CREATOR_ID.getAttr(), PromotionActivityManagementEnum.STATUS.getAttr())),
    WRITE_OFF_RECORD(XbbRefTypeEnum.WRITE_OFF_RECORD.getCode(), Arrays.asList(WriteOffRecordEnum.ORDER_STATUS.getAttr(), WriteOffRecordEnum.DISTRIBUTOR_ID.getAttr()),  Arrays.asList(WriteOffRecordEnum.ORDER_STATUS.getAttr(), WriteOffRecordEnum.DISTRIBUTOR_ID.getAttr())),


    // 信用管理
    CREDIT_LIMIT(XbbRefTypeEnum.CREDIT_LIMIT.getCode(), Arrays.asList(CreditLimitEnum.STATUS.getAttr(), CreditLimitEnum.CUSTOMER_ID.getAttr()), Arrays.asList(CreditLimitEnum.STATUS.getAttr(), CreditLimitEnum.CUSTOMER_ID.getAttr())),
    CREDIT_TEMPORARY_LIMIT(XbbRefTypeEnum.CREDIT_TEMPORARY_LIMIT.getCode(), Arrays.asList(CreditTemporaryLimitEnum.CUSTOMER_ID.getAttr(), CreditTemporaryLimitEnum.APPLY_ID.getAttr()), Arrays.asList(CreditTemporaryLimitEnum.CUSTOMER_ID.getAttr(), CreditTemporaryLimitEnum.APPLY_ID.getAttr())),
    CREDIT_FIXED_LIMIT(XbbRefTypeEnum.CREDIT_FIXED_LIMIT.getCode(), Arrays.asList(CreditFixedLimitEnum.APPLY_LIMIT.getAttr(), CreditFixedLimitEnum.APPLY_ID.getAttr()), Arrays.asList(CreditFixedLimitEnum.APPLY_LIMIT.getAttr(), CreditFixedLimitEnum.APPLY_ID.getAttr())),
    //对账单
    CUSTOMER_STATEMENT_STATISTIC(XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getCode(), Arrays.asList(CustomerStatementStatisticEnum.CUSTOMER_ID.getAttr(),CustomerStatementStatisticEnum.CHECK_DATE.getAttr(), CustomerStatementStatisticEnum.OWNER_ID.getAttr(),CustomerStatementStatisticEnum.CREATE_DATE.getAttr()),Arrays.asList(CustomerStatementStatisticEnum.CREATE_DATE.getAttr())),
    // 产品价目
    PRICE_PRODUCT(XbbRefTypeEnum.PRICE_SET_PRODUCT.getCode(), Arrays.asList(PriceSetEnum.NAME.getAttr(), PriceSetEnum.ADAPTER_TYPE.getAttr(), PriceSetEnum.PRODUCT.getAttr()), Arrays.asList(PriceSetEnum.NAME.getAttr(), PriceSetEnum.ADAPTER_TYPE.getAttr(), PriceSetEnum.PRODUCT.getAttr())),
    //在线支付流水
    ONLINE_PAYMENT_FLOW(XbbRefTypeEnum.ONLINE_PAYMENT_FLOW.getCode(), Arrays.asList(OnlinePaymentFlowDistributorEnum.SERIAL_NO.getAttr(), OnlinePaymentFlowDistributorEnum.PAY_METHOD.getAttr(),
            OnlinePaymentFlowDistributorEnum.STATUS.getAttr(), OnlinePaymentFlowDistributorEnum.PAY_TIME.getAttr()), Arrays.asList(OnlinePaymentFlowDistributorEnum.SERIAL_NO.getAttr(), OnlinePaymentFlowDistributorEnum.PAY_METHOD.getAttr(),
            OnlinePaymentFlowDistributorEnum.STATUS.getAttr(), OnlinePaymentFlowDistributorEnum.PAY_TIME.getAttr())),
    //其他收入单
    OTHER_INCOME(XbbRefTypeEnum.OTHER_INCOME.getCode(), Arrays.asList(OtherIncomeEnum.BELONG_ID.getAttr(), OtherIncomeEnum.INCOME_TIME.getAttr()), Arrays.asList(OtherIncomeEnum.BELONG_ID.getAttr(), OtherIncomeEnum.INCOME_TIME.getAttr())),
    //其他支出单
    OTHER_EXPENSE(XbbRefTypeEnum.OTHER_EXPENSE.getCode(), Arrays.asList(OtherExpenseEnum.BELONG_ID.getAttr(), OtherExpenseEnum.EXPENSE_TIME.getAttr()), Arrays.asList(OtherExpenseEnum.BELONG_ID.getAttr(), OtherExpenseEnum.EXPENSE_TIME.getAttr())),
    //资金调拨单
    FUND_TRANSFER(XbbRefTypeEnum.FUND_TRANSFER.getCode(), Arrays.asList(FundTransferEnum.BELONG_ID.getAttr(), FundTransferEnum.TRANSFER_TIME.getAttr()), Arrays.asList(FundTransferEnum.BELONG_ID.getAttr(), FundTransferEnum.TRANSFER_TIME.getAttr())),
    //成本调整单
    COST_ADJUST(XbbRefTypeEnum.COST_ADJUST.getCode(), Arrays.asList(CostAdjustEnum.ADJUST_NO.getAttr(), CostAdjustEnum.ADJUST_TIME.getAttr(), CostAdjustEnum.OWNER_ID.getAttr(), CostAdjustEnum.CREATOR_ID.getAttr(), CostAdjustEnum.ADD_TIME.getAttr()),
            Arrays.asList(CostAdjustEnum.ADJUST_NO.getAttr(), CostAdjustEnum.ADJUST_TIME.getAttr(), CostAdjustEnum.OWNER_ID.getAttr(), CostAdjustEnum.CREATOR_ID.getAttr(), CostAdjustEnum.ADD_TIME.getAttr())),

    KNOWLEDGE_BASE(XbbRefTypeEnum.KNOWLEDGE_BASE.getCode(), Arrays.asList(KnowledgeDataEnum.STATUS.getAttr(),KnowledgeDataEnum.LABEL.getAttr()),Arrays.asList(KnowledgeDataEnum.STATUS.getAttr(),KnowledgeDataEnum.LABEL.getAttr())),
    // 竞争对手
    COMPEITOR(XbbRefTypeEnum.COMPETITOR.getCode(),Arrays.asList(CompetitorEnum.NAME.getAttr(),CompetitorEnum.ADD_TIME.getAttr()),Arrays.asList(CompetitorEnum.NAME.getAttr(),CompetitorEnum.ADD_TIME.getAttr())),

    /**
     * 工单v2
     */
    // 工单v2
    WORK_ORDER_V2(XbbRefTypeEnum.WORK_ORDER_V2.getCode(),Arrays.asList(FieldTypeEnum.OWNERID.getAlias(), "text_3", "text_2",  FieldTypeEnum.ADDTIME.getAlias(), "address_1"),Arrays.asList(FieldTypeEnum.OWNERID.getAlias(), "text_2",  FieldTypeEnum.ADDTIME.getAlias())),
    RECEIPT_ORDER(XbbRefTypeEnum.RECEIPT_ORDER.getCode(), Arrays.asList("text_2", "text_1", FieldTypeEnum.ADDTIME.getAlias()),
            Arrays.asList("text_2", "text_1", FieldTypeEnum.ADDTIME.getAlias())),

    SLA_LOG(XbbRefTypeEnum.SLA_LOG.getCode(),Arrays.asList(FieldTypeEnum.OWNERID.getAlias(), "text_7", "text_4",
            "text_3", "text_2", FieldTypeEnum.ADDTIME.getAlias()),
            Arrays.asList(FieldTypeEnum.OWNERID.getAlias(), "text_7", "text_4",
                    "text_3", "text_2", FieldTypeEnum.ADDTIME.getAlias())),

    WORK_ORDER_V2_APPOINT(XbbRefTypeEnum.WORK_ORDER_V2_APPOINT.getCode(),Arrays.asList(FieldTypeEnum.OWNERID.getAlias(), "text_3", "text_2",  FieldTypeEnum.ADDTIME.getAlias(), "address_1"),Arrays.asList(FieldTypeEnum.OWNERID.getAlias(), "text_2",  FieldTypeEnum.ADDTIME.getAlias()));
    ;

    private Integer code;
    private List<String> screenList;
    private List<String> dingdingScreenList;

    DefaultScreenEnum(Integer code, List<String> screenList, List<String> dingdingScreenList) {
        this.code = code;
        this.screenList = screenList;
        this.dingdingScreenList = dingdingScreenList;
    }

    public Integer getCode() {
        return code;
    }

    public static String getDefaultValue(Integer businessType, Integer subBusinessType, String platform){
        XbbRefTypeEnum xbbRefTypeEnum = XbbRefTypeEnum.getByCode(subBusinessType);
        switch (xbbRefTypeEnum) {
            case WAIT_PURCHASE:
                if (Objects.equals(businessType, XbbRefTypeEnum.CONTRACT.getCode())) {
                    businessType = XbbRefTypeEnum.WAIT_PURCHASE_CONTRACT.getCode();
                } else {
                    businessType = XbbRefTypeEnum.WAIT_PURCHASE_PRODUCT.getCode();
                }
                break;
            case WAIT_PRODUCE:
                if (Objects.equals(businessType, XbbRefTypeEnum.CONTRACT.getCode())) {
                    businessType = XbbRefTypeEnum.WAIT_PRODUCE_CONTRACT.getCode();
                } else {
                    businessType = XbbRefTypeEnum.WAIT_PRODUCE_PRODUCT.getCode();
                }
                break;
            case WAIT_OUTSTOCK:
                businessType = XbbRefTypeEnum.WAIT_OUTSTOCK.getCode();
                break;
            case WAIT_INSTOCK_PURCHASE:
                businessType = XbbRefTypeEnum.WAIT_INSTOCK_PURCHASE.getCode();
                break;
            case STOCK_FLOW_BILL:
                businessType = XbbRefTypeEnum.STOCK_FLOW_BILL.getCode();
                break;
            case BATCH_FLOW_BILL:
                businessType = XbbRefTypeEnum.BATCH_FLOW_BILL.getCode();
                break;
            case STOCK_STANDING_BOOK:
                businessType = XbbRefTypeEnum.STOCK_STANDING_BOOK.getCode();
                break;
            case SUPPLIER_PRODUCT:
                businessType = XbbRefTypeEnum.SUPPLIER_PRODUCT.getCode();
                break;
            case GUARANTEE_SEARCH:
                businessType = XbbRefTypeEnum.GUARANTEE_SEARCH.getCode();
                break;
            default:
                break;
        }
        DefaultScreenEnum defaultScreenEnum = getByCode(businessType);
        if (Objects.isNull(defaultScreenEnum)){
            return "";
        }
        List<String> screenList = new ArrayList<>();
        if (PlatFormEnum.DINGTALK.getValue().equals(platform)) {
            screenList = defaultScreenEnum.dingdingScreenList;
        } else {
            screenList = defaultScreenEnum.screenList;
        }
        String defaultScreenStr = screenList.toString();
        defaultScreenStr = defaultScreenStr.replaceAll(" ","");
        return defaultScreenStr.substring(1,defaultScreenStr.length() - 1);
    }

    public static DefaultScreenEnum getByCode(Integer code){
        for (DefaultScreenEnum defaultScreenEnum : values()){
            if (Objects.equals(defaultScreenEnum.code,code)){
                return defaultScreenEnum;
            }
        }
        return null;
    }
}
